#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project: DataStructure-Python
@File: 02_list.py
@Author: Dragon Geek
@Date: 2021/4/19 10:15
@Description: Bubble Sort Algorithm
"""


from timeit import Timer

list_01 = [1, 2]
list_02 = [23, 5]


def test01():
    list_03 = []
    for i in range(10000):
        list_03.append(i)


def test02():
    list_03 = []
    for i in range(10000):
        list_03 += [i]


def test03():
    list_03 = [i for i in range(10000)]


def test04():
    list_03 = list(range(10000))


def test05():
    list_05 = []
    for i in range(10000):
        list_05.append(i)


timer1 = Timer("test01()", "from __main__ import test01")
print("append:", timer1.timeit(1000))
timer2 = Timer("test02()", "from __main__ import test02")
print("+:", timer2.timeit(1000))
timer3 = Timer("test03()", "from __main__ import test03")
print("[i for i in range()]:", timer3.timeit(1000))
timer4 = Timer("test04()", "from __main__ import test04")
print("list(range()):", timer4.timeit(1000))
timer5 = Timer("test05()", "from __main__ import test05")
print("list(range()):", timer5.timeit(1000))